' Test oh an2 file load and save quadratic data.txt b+ 2021-03-13
' this file corrects spelling of next line and importantly tests set taking SFunctions in 3rd argument.
' Now 3/14, testing the SFunction var = nItmes[AString]

. Quadratic = (x + 5) (2x + 6) = 2x^2 + 16x + 30
set file;1;Quadratic = (x + 5) (2x + 6) = 2x^2 + 16x + 30
. expected roots are -3, -5
set file;2;expected roots are -3 and -5
a = 2
b = 16
c = 30
set file;3;a = 2  b = 16  c = 30
d = p[s[x[b,b],x[4,a,c]],.5]
root1 = d[a[s[0, b],d],x[2,a]]
root2 = d[s[s[0, b],d],x[2,a]]
.     d = ;d
. root1 = ;root1
. root2 = ;root2
set file;4;bnd[    d = ,d]
set file;5;bnd[root1 = ,root1]
set file;6;bnd[root2 = ,root2]

'calc a small table of F(x)
x = -11 
i = 7
[
	x = a[x,1]
	jmp gt[x,10]
	i = a[i,1]
	fx = a[x[2,x,x],x[16,x],30]
	fline = bnd[f(,x,) = ,fx]
	. x;spc[2];fx;spc[2];fline
	set file;i;fline
]
. number of lines = ;i
newNItems = nitems[file]
. Test new nItems SFunction have: ;newNItems;, to file.
numberOfLines = i
save file;Quadratic Data2 2x^2+16x+30.Dat
. data saved to file, press any to load data file and display...
zzz
cls
fdata = load[Quadratic Data2 2x^2+16x+30.Dat]
newNItems = nitems[fdata]
. new nItems should tell us how many lines we just loaded = ;newNItems
. Dang always get one more line... now 3/17 fixed! New Load Code
i = 0
[
	i = a[i,1]
	jmp gt[i,numberOfLines]
	fline = get[fdata,i]
	. fline
]